﻿`   `1  @{
    Layout = "~/Views/Shared/_LayoutPageAdmin.cshtml";
}

@model abc.Models.State
<div id="page-wrapper">
    <div class="container-fluid">

        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h2 class="panel-title">States</h2>
                </div>
                <div class="panel-body">

                    <div class="row">
                        <div class="col-lg-6">
                            <button type="button" class="btn btn-lg btn-primary" onclick="location.href='@Url.Action("AddEditStates", "Admin")'">
                                Add New
                                <i class="fa fa-plus"></i>
                            </button>
                        </div>
                        <div class="col-lg-6">
                            <div class="col-lg-3">
                                <label>Search::</label>
                            </div>
                            <div class="col-lg-9">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="Search Here" />
                                    <span class="input-group-btn">
                                        <button class="btn btn-default" type="button">
                                            <i class="fa fa-search"></i>
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <br />

                    <div class="row">

                    </div>

                    <br />

                    <div class="row">
                        <div class="col-lg-12">

                            <div class="table-responsive">
                                @if (ViewBag.GetAllStates == null)
                                {
                                    <text>No State Records Found</text>
                                }
                                else
                                {
                                    <table class="table table-bordered table-hover table-striped">
                                        <thead>
                                            <tr>
                                                <th>S.No</th>
                                                <th>State Name</th>
                                                <th>Country</th>
                                                <th>Status</th>
                                                <th>Edit</th>
                                                <th>Change Status</th>
                                            </tr>
                                        </thead>
                                        <tbody>                                           

                                            @foreach (var item in ViewBag.GetAllStates)
                                            {
                                                <tr>
                                                    <td>@item.State_Id</td>
                                                    <td>@item.State_Name</td>
                                                    
                                                    <td>@item.State_Status</td>
                                                    <td>
                                                        @{
                                                using (@Html.BeginForm("EditState", "Admin", FormMethod.Post))
                                                {
                                                    <input type="hidden" name="State_Id" value="@item.State_Id" />
                                                            <input type="submit" class="btn btn-default btn-sm" value="Edit" />
                                                }
                                                        }
                                                    </td>
                                                    <td>
                                                        @{
                                                using (@Html.BeginForm("StateChangeStatus", "Admin", FormMethod.Post))
                                                {
                                                    <input type="hidden" name="State_Id" value="@item.State_Id" />
                                                            <input type="submit" class="btn btn-default btn-sm" value="Toggle" />
                                                }
                                                        }
                                                    </td>
                                                </tr>
                                            }


                                        </tbody>
                                    </table>
                                }
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>